package com.heima.api;

import com.heima.model.schedule.dtos.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("leadnews-schedule")
public interface IScheduleClientFeign {

    /**
     * 添加任务
     * @param task   任务对象
     * @return       任务id
     */
    @PostMapping("/api/v1/schedule/addTask")
    public void addTask(@RequestBody Task task);


    /**
     * 拉取任务，消费任务
     * @param taskType 类型
     * @param priority 优先级
     * @return
     */
    @GetMapping("/api/v1/schedule/pull/{taskType}/{priority}")
    public Task pullTask(@PathVariable Integer taskType, @PathVariable Integer priority);
}
